
ENT.Type = "anim"
ENT.Base = "base_gmodentity"

ENT.PrintName = "Letter"
ENT.Author = "[GU]|ZLC|thomasfn"
ENT.Contact = "Don't."
ENT.Instructions = "Press e to use it."
ENT.Purpose = ""

ENT.Spawnable = false
ENT.AdminSpawnable = false

ENT.ItemModel = "models/props_c17/paper01.mdl"
util.PrecacheModel( ENT.ItemModel )

ENT.IsLetter = true

if (SERVER) then

	AddCSLuaFile( "shared.lua" )
	
	ENT.NextUse = CurTime()

	function ENT:Initialize()
		self.Entity:SetModel(self.ItemModel)
		self.Entity:PhysicsInit(SOLID_VPHYSICS)
		self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
		self.Entity:SetSolid(SOLID_VPHYSICS)
		
		if (!self.Text) then self.Text = "" end		
		
		local phys = self.Entity:GetPhysicsObject()
		if (phys && phys:IsValid()) then phys:Wake() end
	end
	
	function ENT:Use( activator, ply )
		if (CurTime() < self.NextUse) then return end
		self.NextUse = CurTime()+1
		
		umsg.Start( "_pcmod_letter", ply )
		umsg.String( self.Text )
		umsg.End()
	end
	
	
	
end

if (CLIENT) then

	function ENT:Draw()
		// Draw our entity
		self.BaseClass.Draw( self )

	end
	
end